function CustomFileBrowser(field_name, url, type, win) {
    tinyMCE.activeEditor.windowManager.open({
		title: "File Browser",
	    file: "/admin/filebrowser/?pop=2",
    	width: 820,
    	height: 600,
    	close_previous: "no",
		inline: "yes",
		scrollbars : "yes",
		resizable: "yes"
	}
    , {
        window : win,
        input : field_name,
        editor_id: tinyMCE.selectedInstance.editorId
    });
    return false;
	
  }

function myCustomSetupContent(editor_id, body, doc) {
    if (body.innerHTML == "") {
        body.innerHTML = "<p>xxx</p>";
    }
}

// set buttons vars
var buttons1 = "fullscreen,preview,separator,cut,copy,pastetext,pasteword,separator,undo,redo,separator,link,unlink,anchor,separator,image,template,cleanup,media,related_news,caption_image,caption_image_right,caption_image_center";
var buttons2 = "formatselect,separator,bold,italic,underline,strikethrough,sub,sup,separator,bullist,numlist,outdent,indent,separator,justifyleft,justifyright,justifycenter,separator,help,code,cleanup";

tinyMCE.init({
	mode : "textareas",
	theme : "advanced",
	plugins : "table,advhr,advimage,advlink,preview,fullscreen,template,paste,media",
	theme_advanced_buttons1 : buttons1,
	theme_advanced_buttons2 : buttons2,
	theme_advanced_buttons3 : "",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	
	fullscreen_new_window : false,
	fullscreen_settings : {
		theme_advanced_buttons1 : buttons1,
		theme_advanced_buttons2 : buttons2,
		theme_advanced_buttons3 : ""
	},	
	
	theme_advanced_statusbar_location : "bottom",
	theme_advanced_resizing : true,
	auto_cleanup_word : true,
    theme_advanced_path : false,
    width: '500',
    height: '200',	
	plugin_insertdate_dateFormat : "%d/%m/%Y",
	plugin_insertdate_timeFormat : "%H:%M:%S",
	extended_valid_elements : "a[name|href|target=_blank|title|onclick],img[*],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style],div[*],ul[*],li[*],table[*],td[*],tr[*],p[*],style[type]",
	relative_urls : false,
	force_br_newlines: false,
	file_browser_callback : "CustomFileBrowser",
	popup_css_add: "/media/filebrowser/css/filebrowser.css",
	paste_create_paragraphs : true,
	paste_create_linebreaks : true,
	paste_use_dialog : false,
	paste_auto_cleanup_on_paste : true,
	paste_convert_middot_lists : false,
	paste_unindented_list_class : "unindentedList",
	paste_convert_headers_to_strong : true,
	fullscreen_settings : {
		theme_advanced_path_location : "top",
		theme_advanced_buttons1 : "fullscreen,preview,separator,cut,copy,paste,separator,undo,redo,separator,bold,italic,underline,strikethrough,sub,sup,separator,bullist,numlist,outdent,indent,link,unlink,anchor,separator,image,template,cleanup",
		theme_advanced_buttons2 : "formatselect,fontselect,fontsizeselect,separator,forecolor,backcolor,separator,help,separator,code,tablecontrols",
		theme_advanced_buttons3 : ""
	},

	});
